#include<iostream>
using namespace std;
int Count(int x,int sg[]){
	if(x==1){
		return 1;
	}
	else if(x<=3){
		return 2;
	}
	int s=1,a;
	for(int i=1;i<=x/2;i++){
		if(sg[i]==0){
			a=Count(i,sg);
			s+=a;
			sg[i]=a;
		}
		else{
			s+=sg[i];
		}
	}
	return s;
}
int main(){
	int n;
	cin>>n;
	int sg[n]={0};
	cout<<Count(n,sg);
} 
